import { _decorator, Component, Node } from 'cc';
import { losChannel } from 'db://assets/app/Script/SDK/losChannel';
import { _logic, _gameType } from 'db://assets/main/script/Main';
import { ECubesType } from 'db://assets/main/script/module/define/LogicDefine';
const { ccclass, property } = _decorator;

@ccclass('UnLockSoltUI')
export class UnLockSoltUI extends Component {
    @property(Node)
    private cVideoSp: Node = null!;
    @property(Node)
    private cVideoLb: Node = null!;

    start() {

    }
    protected onEnable(): void {

    }

    public OnClick() {
        const self = this;
        let showVd = function () {
            losChannel.instance().showVideo({
                sucCall: () => {
                    for (let data of _logic.data.datas) {
                        if (data.type == ECubesType.tempVideo) {
                            _logic.changeType(data, ECubesType.data)
                            break
                        }
                    }
                    self.OnClose()
                }, failCall: () => { }, endCall: () => {

                }, posName: "video"
            })
        }
        losChannel.instance().checkShortcut({
            sucCall: () => {
                losChannel.instance().addShortcut({
                    sucCall: () => {
                        for (let data of _logic.data.datas) {
                            if (data.type == ECubesType.tempVideo) {
                                _logic.changeType(data, ECubesType.data)
                                break
                            }
                        }
                        self.OnClose()
                    },
                    failCall: () => {
                        // showVd()
                    }
                })
            },
            failCall: () => {
                showVd()
            }
        })

    }
    /**
     * onClose
     */
    public OnClose() {
        this.node.removeFromParent()
    }
}


